/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.anhanguera.tcc.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "tb_comprovante_entrega")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ComprovanteEntrega.findAll", query = "SELECT c FROM ComprovanteEntrega c"),
    @NamedQuery(name = "ComprovanteEntrega.findByIdComprovanteEntrega", query = "SELECT c FROM ComprovanteEntrega c WHERE c.idComprovanteEntrega = :idComprovanteEntrega"),
    @NamedQuery(name = "ComprovanteEntrega.findByNuComprovanteEntrega", query = "SELECT c FROM ComprovanteEntrega c WHERE c.nuComprovanteEntrega = :nuComprovanteEntrega"),
    @NamedQuery(name = "ComprovanteEntrega.findByDtComprovanteEntrega", query = "SELECT c FROM ComprovanteEntrega c WHERE c.dtComprovanteEntrega = :dtComprovanteEntrega"),
    @NamedQuery(name = "ComprovanteEntrega.findByQtMedidorFim", query = "SELECT c FROM ComprovanteEntrega c WHERE c.qtMedidorFim = :qtMedidorFim"),
    @NamedQuery(name = "ComprovanteEntrega.findByQtMedidorInicio", query = "SELECT c FROM ComprovanteEntrega c WHERE c.qtMedidorInicio = :qtMedidorInicio"),
    @NamedQuery(name = "ComprovanteEntrega.findByNuIsm", query = "SELECT c FROM ComprovanteEntrega c WHERE c.nuIsm = :nuIsm"),
    @NamedQuery(name = "ComprovanteEntrega.findByNuCartao", query = "SELECT c FROM ComprovanteEntrega c WHERE c.nuCartao = :nuCartao"),
    @NamedQuery(name = "ComprovanteEntrega.findByHrInicio", query = "SELECT c FROM ComprovanteEntrega c WHERE c.hrInicio = :hrInicio"),
    @NamedQuery(name = "ComprovanteEntrega.findByHrFim", query = "SELECT c FROM ComprovanteEntrega c WHERE c.hrFim = :hrFim"),
    @NamedQuery(name = "ComprovanteEntrega.findByInSituacao", query = "SELECT c FROM ComprovanteEntrega c WHERE c.inSituacao = :inSituacao")})
public class ComprovanteEntrega implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_COMPROVANTE_ENTREGA")
    private Integer idComprovanteEntrega;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "NU_COMPROVANTE_ENTREGA")
    private String nuComprovanteEntrega;
    @Column(name = "DT_COMPROVANTE_ENTREGA")
    @Temporal(TemporalType.DATE)
    private Date dtComprovanteEntrega;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "QT_MEDIDOR_FIM")
    private BigDecimal qtMedidorFim;
    @Column(name = "QT_MEDIDOR_INICIO")
    private BigDecimal qtMedidorInicio;
    @Size(max = 45)
    @Column(name = "NU_ISM")
    private String nuIsm;
    @Size(max = 45)
    @Column(name = "NU_CARTAO")
    private String nuCartao;
    @Column(name = "HR_INICIO")
    @Temporal(TemporalType.TIME)
    private Date hrInicio;
    @Column(name = "HR_FIM")
    @Temporal(TemporalType.TIME)
    private Date hrFim;
    @Size(max = 2)
    @Column(name = "IN_SITUACAO")
    private String inSituacao;
    @JoinColumn(name = "COD_AEROPORTO", referencedColumnName = "ID_AEROPORTO")
    @ManyToOne(optional = false)
    private Aeroporto codAeroporto;
    @JoinColumn(name = "COD_CONTRATO", referencedColumnName = "ID_CONTRATO")
    @ManyToOne(optional = false)
    private Contrato codContrato;
    @JoinColumn(name = "COD_DOCUMENTO_FISCAL", referencedColumnName = "ID_DOCUMENTO_FISCAL")
    @ManyToOne
    private DocumentoFiscal codDocumentoFiscal;
    @JoinColumn(name = "COD_USUARIO_CADASTRADOR", referencedColumnName = "ID_USUARIO")
    @ManyToOne(optional = false)
    private Usuario codUsuarioCadastrador;
    @JoinColumn(name = "COD_VEICULO", referencedColumnName = "ID_VEICULO")
    @ManyToOne(optional = false)
    private Aeronave codVeiculo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "comprovanteEntrega")
    private List<ItemComprovanteEntrega> itemComprovanteEntregaList;
    @OneToMany(mappedBy = "codComprovanteEntrega")
    private List<Ocorrencia> ocorrenciaList;

    public ComprovanteEntrega() {
    }

    public ComprovanteEntrega(Integer idComprovanteEntrega) {
        this.idComprovanteEntrega = idComprovanteEntrega;
    }

    public ComprovanteEntrega(Integer idComprovanteEntrega, String nuComprovanteEntrega) {
        this.idComprovanteEntrega = idComprovanteEntrega;
        this.nuComprovanteEntrega = nuComprovanteEntrega;
    }

    public Integer getIdComprovanteEntrega() {
        return idComprovanteEntrega;
    }

    public void setIdComprovanteEntrega(Integer idComprovanteEntrega) {
        this.idComprovanteEntrega = idComprovanteEntrega;
    }

    public String getNuComprovanteEntrega() {
        return nuComprovanteEntrega;
    }

    public void setNuComprovanteEntrega(String nuComprovanteEntrega) {
        this.nuComprovanteEntrega = nuComprovanteEntrega;
    }

    public Date getDtComprovanteEntrega() {
        return dtComprovanteEntrega;
    }

    public void setDtComprovanteEntrega(Date dtComprovanteEntrega) {
        this.dtComprovanteEntrega = dtComprovanteEntrega;
    }

    public BigDecimal getQtMedidorFim() {
        return qtMedidorFim;
    }

    public void setQtMedidorFim(BigDecimal qtMedidorFim) {
        this.qtMedidorFim = qtMedidorFim;
    }

    public BigDecimal getQtMedidorInicio() {
        return qtMedidorInicio;
    }

    public void setQtMedidorInicio(BigDecimal qtMedidorInicio) {
        this.qtMedidorInicio = qtMedidorInicio;
    }

    public String getNuIsm() {
        return nuIsm;
    }

    public void setNuIsm(String nuIsm) {
        this.nuIsm = nuIsm;
    }

    public String getNuCartao() {
        return nuCartao;
    }

    public void setNuCartao(String nuCartao) {
        this.nuCartao = nuCartao;
    }

    public Date getHrInicio() {
        return hrInicio;
    }

    public void setHrInicio(Date hrInicio) {
        this.hrInicio = hrInicio;
    }

    public Date getHrFim() {
        return hrFim;
    }

    public void setHrFim(Date hrFim) {
        this.hrFim = hrFim;
    }

    public String getInSituacao() {
        return inSituacao;
    }

    public void setInSituacao(String inSituacao) {
        this.inSituacao = inSituacao;
    }

    public Aeroporto getCodAeroporto() {
        return codAeroporto;
    }

    public void setCodAeroporto(Aeroporto codAeroporto) {
        this.codAeroporto = codAeroporto;
    }

    public Contrato getCodContrato() {
        return codContrato;
    }

    public void setCodContrato(Contrato codContrato) {
        this.codContrato = codContrato;
    }

    public DocumentoFiscal getCodDocumentoFiscal() {
        return codDocumentoFiscal;
    }

    public void setCodDocumentoFiscal(DocumentoFiscal codDocumentoFiscal) {
        this.codDocumentoFiscal = codDocumentoFiscal;
    }

    public Usuario getCodUsuarioCadastrador() {
        return codUsuarioCadastrador;
    }

    public void setCodUsuarioCadastrador(Usuario codUsuarioCadastrador) {
        this.codUsuarioCadastrador = codUsuarioCadastrador;
    }

    public Aeronave getCodVeiculo() {
        return codVeiculo;
    }

    public void setCodVeiculo(Aeronave codVeiculo) {
        this.codVeiculo = codVeiculo;
    }

    @XmlTransient
    public List<ItemComprovanteEntrega> getItemComprovanteEntregaList() {
        return itemComprovanteEntregaList;
    }

    public void setItemComprovanteEntregaList(List<ItemComprovanteEntrega> itemComprovanteEntregaList) {
        this.itemComprovanteEntregaList = itemComprovanteEntregaList;
    }

    @XmlTransient
    public List<Ocorrencia> getOcorrenciaList() {
        return ocorrenciaList;
    }

    public void setOcorrenciaList(List<Ocorrencia> ocorrenciaList) {
        this.ocorrenciaList = ocorrenciaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idComprovanteEntrega != null ? idComprovanteEntrega.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ComprovanteEntrega)) {
            return false;
        }
        ComprovanteEntrega other = (ComprovanteEntrega) object;
        if ((this.idComprovanteEntrega == null && other.idComprovanteEntrega != null) || (this.idComprovanteEntrega != null && !this.idComprovanteEntrega.equals(other.idComprovanteEntrega))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.anhanguera.tcc.model.ComprovanteEntrega[ idComprovanteEntrega=" + idComprovanteEntrega + " ]";
    }

}
